import Vue from 'vue';
import Router from 'vue-router';
const _import = require('./_import_' + process.env.NODE_ENV);
// in development env not use Lazy Loading,because Lazy Loading large page will cause webpack hot update too slow.so only in production use Lazy Loading

Vue.use(Router);

/* layout */
import Layout from '../views/layout/Layout';

/**
 * icon : the icon show in the sidebar
 * hidden : if `hidden:true` will not show in the sidebar
 * redirect : if `redirect:noredirect` will no redirct in the levelbar
 * noDropdown : if `noDropdown:true` will has no submenu
 * meta : { role: ['admin'] }  will control the page role
 **/
export const constantRouterMap = [{
  path: '/login',
  component: _import('login/index'),
  hidden: true
},
{
  path: '/authredirect',
  component: _import('login/authredirect'),
  hidden: true
},
{
  path: '/404',
  component: _import('error/404'),
  hidden: true
},
{
  path: '/401',
  component: _import('error/401'),
  hidden: true
},
{
  path: '/',
  component: Layout,
  redirect: '/dashboard',
  name: '首页',
  hidden: true,
  children: [{
    path: 'dashboard',
    component: _import('dashboard/index')
  }]
},
{
  path: '/introduction',
  component: Layout,
  redirect: '/introduction/index',
  icon: 'form',
  noDropdown: true,
  children: [{
    path: 'index',
    component: _import('introduction/index'),
    name: '简述'
  }]
}
]

export default new Router({
  // mode: 'history', //后端支持可开
  scrollBehavior: () => ({
    y: 0
  }),
  routes: constantRouterMap
});

export const asyncRouterMap = [{
  path: '/baseManager',
  component: Layout,
  name: '基础配置管理',
  icon: 'setting',
  authority: 'baseManager',
  children: [{
    path: 'userManager',
    icon: 'fa-user',
    component: _import('admin/user/index'),
    name: '用户管理',
    authority: 'userManager'
  }, {
    path: 'menuManager',
    icon: 'category',
    component: _import('admin/menu/index'),
    name: '菜单管理',
    authority: 'menuManager'
  }, {
    path: 'groupManager',
    icon: 'group_fill',
    component: _import('admin/group/index'),
    name: '角色权限管理',
    authority: 'groupManager'
  }, {
    path: 'groupTypeManager',
    icon: 'fa-users',
    component: _import('admin/groupType/index'),
    name: '角色类型管理',
    authority: 'groupTypeManager'
  }, {
    path: 'gateLogManager',
    icon: 'viewlist',
    component: _import('admin/gateLog/index'),
    name: '操作日志管理',
    authority: 'gateLogManager'
  }]
},
{
path: '/dataTableManager',
component: Layout,
name: '参数管理',
icon: 'setting',
authority: 'dataTableManager',
children: [{
	path: 'whIpFilterManager',
	component: _import('admin/whIpFilter/index'),
	name: 'IP白名单配置',
	authority: 'whIpFilterManager'
}, {
	path: 'raAppidCityManager',
	component: _import('admin/raAppidCity/index'),
	name: '渠道配置',
	authority: 'raAppidCityManager'
}, {
	path: 'yyServiceFunctionManager',
	component: _import('admin/yyServiceFunction/index'),
	name: '服务方法',
	authority: 'yyServiceFunctionManager'
}, {
	path: 'yyChannelFunctionManager',
	component: _import('admin/yyChannelFunction/index'),
	name: '渠道方法',
	authority: 'yyChannelFunctionManager'
}, {
	path: 'whSystemParameterManager',
	component: _import('admin/whSystemParameter/index'),
	name: '系统参数配置',
	authority: 'whSystemParameterManager'
}, {
	path: 'marketingInfoManager',
	component: _import('admin/marketingInfo/index'),
	name: '运营活动配置',
	authority: 'marketingInfoManager'
}, {
	path: 'whCityManager',
	component: _import('admin/whCity/index'),
	name: '城市配置',
	authority: 'whCityManager'
}, {
	path: 'whZtDisplayManager',
	component: _import('admin/whZtDisplay/index'),
	name: '展台配置',
	authority: 'whZtDisplayManager'
}, {
	path: 'whSystemCodeManager',
	component: _import('admin/whSystemCode/index'),
	name: '系统代码表',
	authority: 'whSystemCodeManager'
}, {
	path: 'insRouteManager',
	component: _import('admin/insRoute/index'),
	name: '支付渠道路由',
	authority: 'insRouteManager'
}, {
	path: 'whImportantAuthCertManager',
	component: _import('admin/whImportantAuthCert/index'),
	name: '重要认证公钥管理',
	authority: 'whImportantAuthCertManager'
}]
},{
	path: '/medicalManager',
	component: Layout,
	name: '医疗机构管理',
	icon: 'setting',
	authority: 'medicalManager',
	children: [{
		path: 'organManager',
		component: _import('admin/organ/index'),
		name: '医疗机构维护(旧)',
		authority: 'organManager'
	}, {
		path: 'organCatageryManager',
		component: _import('admin/organCatagery/index'),
		name: '医疗机构类目维护',
		authority: 'organCatageryManager'
	}, {
		path: 'organNewManager',
		component: _import('admin/organNew/index'),
		name: '医疗机构维护',
		authority: 'organNewManager'
	}]
},
{
	path: '/queryManager',
	component: Layout,
	name: '绑卡信息管理',
	icon: 'setting',
	authority: 'queryManager',
	children: [{
	path: 'yyUserBindInfoManager',
	component: _import('admin/yyUserBindInfo/index'),
	name: '绑卡状态信息查询',
	authority: 'yyUserBindInfoManager'
	}, {
	path: 'cardQueryManager',
	component: _import('admin/cardQuery/index'),
	name: '社保卡信息查询记录',
	authority: 'cardQueryManager'
	}, {
	path: 'cardBindManager',
	component: _import('admin/cardBind/index'),
	name: '绑卡记录查询',
	authority: 'cardBindManager'
	},{
	path: 'alipayMarketingCardManager',
	component: _import('admin/alipayMarketingCard/index'),
	name: '会员卡查询',
	authority: 'alipayMarketingCardManager'
	}, {
	path: 'orderPayManager',
	component: _import('admin/orderPay/index'),
	name: '订单支付查询',
	authority: 'orderPayManager'
 },{
	path: 'siCardDiffManager',
	component: _import('admin/siCardDiff/index'),
	name: '域内绑卡状态同步',
	authority: 'siCardDiffManager'
 },{
	path: 'whWhiteUserManager',
	component: _import('admin/whWhiteUser/index'),
	name: '绑卡白名单',
	authority: 'whWhiteUserManager'
 },{
 	path: 'whSystemParameterTwoManager',
	component: _import('admin/whSystemParameter/indexTwo'),
	name: '部平台城市限制',
	authority: 'whSystemParameterTwoManager'
 },{
 	path: 'cardBandReflowManager',
	component: _import('admin/yyUserBindInfo/indexTwo'),
	name: '域内数据回流',
	authority: 'cardBandReflowManager'
 },{
 	path: 'alipayCertificateTypeManager',
	component: _import('admin/alipayCertificateType/index'),
	name: '证件类型配置',
	authority: 'alipayCertificateTypeManager'
 }]	
},
{
	path: '/errorManager',
	component: Layout,
	name: '错误码配置',
	icon: 'setting',
	authority: 'errorManager',
	children: [{
		path: 'codeOperationManager',
		component: _import('admin/codeOperation/index'),
		name: '城市错误码',
		authority: 'codeOperationManager'
	}, {
		path: 'codePaymentManager',
		component: _import('admin/codePayment/index'),
		name: '错误码分类',
		authority: 'codePaymentManager'
	}, {
		path: 'originalErrorCodeManager',
		component: _import('admin/originalErrorCode/index'),
		name: '错误码标准化',
		authority: 'originalErrorCodeManager'
	}]
},
{
	path: '/orderManager',
	component: Layout,
	name: '订单查询',
	icon: 'setting',
	authority: 'orderManager',
	children: [{
		path: 'orderPrepareManager',
		component: _import('admin/orderPrepare/index'),
		name: '预结算',
		authority: 'orderPrepareManager'
	}, {
		path: 'orderPayManager',
		component: _import('admin/orderPay/index'),
		name: '结算',
		authority: 'orderPayManager'
	}, {
		path: 'orderCancelPrepareManager',
		component: _import('admin/orderCancelPrepare/index'),
		name: '预退费',
		authority: 'orderCancelPrepareManager'
	}, {
		path: 'orderCancelManager',
		component: _import('admin/orderCancel/index'),
		name: '退费',
		authority: 'orderCancelManager'
	}]
},
{
	path: '/otherQueryManager',
	component: Layout,
	name: '其他查询',
	icon: 'setting',
	authority: 'otherQueryManager',
	children: [{
		path: 'publicSiliveCertifyManager',
		component: _import('admin/publicSiliveCertify/index'),
		name: '资格认证查询',
		authority: 'publicSiliveCertifyManager'
	}]
},
{
	path: '/parameterManager',
	component: Layout,
	name: '参数管理',
	icon: 'setting',
	authority: 'parameterManager',
	children: [{
		path: 'insRouteManager',
		component: _import('admin/insRoute/index'),
		name: '支付渠道路由',
		authority: 'insRouteManager'
	}]
},
{
  path: '/authManager',
  component: Layout,
  name: '基础配置管理',
  icon: 'setting',
  authority: 'authManager',
  children: [{
    path: 'serviceManager',
    component: _import('auth/service/index'),
    name: '用户管理',
    authority: 'serviceManager'
  }]
},
{
  path: '/monitorManager',
  component: Layout,
  name: '监控模块管理',
  icon: 'setting',
  authority: 'monitorManager',
  children: [{
    path: 'serviceEurekaManager',
    component: _import('monitor/eureka/index'),
    name: 'Eureka注册中心',
    authority: 'serviceEurekaManager'
  }, {
    path: 'serviceMonitorManager',
    component: _import('monitor/service/index'),
    name: '服务状态监控',
    authority: 'serviceMonitorManager'
  }, {
    path: 'serviceZipkinManager',
    component: _import('monitor/zipkin/index'),
    name: '服务状态监控',
    authority: 'serviceZipkinManager'
  }]
}];
